<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
    <title>待制证</title>
    <script type="text/javascript" src='${ctx}/static/passport/assets/js/jquery.min.js'></script>
    <script type="text/javascript" src="${ctx}/static/myJs/util.js"></script>
    <link href="${ctx}/static/datetimepicker/bootstrap/css/bootstrap-datetimepicker.min.css" rel="stylesheet"
          media="screen">
    <script type="text/javascript" src="${ctx}/static/datetimepicker/jquery/bootstrap-datetimepicker.js"
            charset="UTF-8"></script>
    <script type="text/javascript" src="${ctx}/static/datetimepicker/jquery/locales/bootstrap-datetimepicker.zh-CN.js"
            charset="UTF-8"></script>
    <link rel="stylesheet" href="${ctx}/static/passport/assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="${ctx}/static/passport/assets/css/build_standalone.less">
    <link rel="stylesheet" href="${ctx}/static/passport/css/reset.css">
    <link rel="stylesheet" href="${ctx}/static/passport/css/common.css">
    <link rel="stylesheet" href="${ctx}/static/passport/css/approvallist.css">
    <link rel="stylesheet" href="${ctx}/static/passport/css/approvallist_bootstrap.css">
    <script type="text/javascript" src='${ctx}/static/passport/assets/js/jquery.min.js'></script>
    <script type="text/javascript" src='${ctx}/static/passport/assets/js/bootstrap.min.js'></script>
    <script type="text/javascript" src='${ctx}/static/passport/js/applicationprocess.js'></script>
    <script type="text/javascript" src="${ctx}/static/js/upload.js"></script>
    <link href="${ctx}/static/jquery-validation/1.11.1/validate.css" type="text/css" rel="stylesheet"/>
    <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
    <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/localization/messages_zh.js"></script>
</head>

<body>
<div class="content">
    <div class="page-subcate-list">
        <div class="page-subcate-item">
<%--            <label>预约日期</label>
            <div class="form-item">
                <div id="inputStartDate" class="input-group date form_date col-md-1" data-date=""
                     data-date-format="yyyy-mm-dd"
                     data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                    <input class="form-control" size="16" type="text" id="startDate" value="" readonly>
                    <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                    <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                </div>
                <input type="hidden" id="dtp_input2" value=""/>
            </div>--%>

            <label>证件号</label>
            <div class="form-item">
                <input type="text" class="form-control" id="cardNO" placeholder="" value="">
            </div>

            <label>订单号</label>
            <div class="form-item">
                <input type="text" class="form-control" id="num" placeholder="" value="">
                <div class="pull-right">
                    <button onclick="javascript:search();" class="pull-left btn">查询</button>
                </div>
            </div>
        </div>
    </div>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>订单</th>
            <th>姓名</th>
            <th>证件号</th>
            <th>手机</th>
            <th>性别</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${data.content}" var="item" varStatus="status">
            <tr id="${item.id}">
                <td>${item.num}</td>
                <td>${item.name}</td>
                <td>${item.cardNO}</td>
                <td>${item.mobile}</td>
                <td>${item.sex}</td>
                <td align="center">
                    <c:if test="${item.status==10}">
                    <button type="button" onclick="javascript:todo('${item.id}','11');" class="common_btn_item btn btn-primary btn-sm">
                        制证
                    </button>
                    <button type="button" disabled class="common_btn_item btn btn-primary btn-sm">
                        复核
                    </button>
                    </c:if>


                    <c:if test="${item.status==11}">
                        <button type="button" disabled class="common_btn_item btn btn-primary btn-sm">
                            制证
                        </button>
                        <button type="button" class="common_btn_item btn btn-primary btn-sm" data-toggle="modal" onclick="javascript:detail('myModal_${item.id}')">
                            复核
                        </button>
                    </c:if>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <tags:pagination page="${data}" paginationSize="5"/>
</div>




<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="printFinsh" aria-hidden="true">
    <div class="passport_certidetail_wrapper modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="printFinsh"></h4>
            </div>
            <div class="modal-body">
                <p class='text-center'>确定要制作此证件？</p>
            </div>
            <input type="hidden" id="_ID" value="">
            <input type="hidden" id="_STATUS" value="">
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="approlist_save_item2 btn btn-primary" onclick="javascript:cmdPrint()">确定</button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="myModal3" tabindex="-2" role="dialog" aria-labelledby="myModalLabel3" aria-hidden="true">
    <div class="passport_certidetail_wrapper modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel3"></h4>
            </div>
            <div class="modal-body">
                <p class='text-center'>证件已制作完成,是否需要重制？</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" onclick="javascript:close3();">完成</button>
                <button type="button" class="approlist_save_item2 btn btn-primary" onclick="javascript:againPrint();">重制</button>
            </div>
        </div>
    </div>
</div>




<c:forEach items="${data.content}" var="item" varStatus="status">
    <div class="modal fade" id="myModal_${item.id}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel_txt_${item.id}" aria-hidden="true">
        <div class="passport_certidetail_wrapper modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title" id="myModalLabel_txt_${item.id}">护照详情</h4>
                </div>
                <div class="modal-body">
                    <dl class="dl-horizontal lead ">
                        <dt>姓名</dt>
                        <dd>${item.name}</dd>
                        <dt>性别</dt>
                        <dd>${item.sex}</dd>
                        <dt>手机号</dt>
                        <dd>${item.mobile}</dd>
                        <dt>护照编号</dt>
                        <dd>${item.passportNO}</dd>
                        <dt>制证单位</dt>
                        <dd>${item.signUnti}</dd>
                        <dt>发证地址</dt>
                        <dd>${item.signAddress}</dd>
                    </dl>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" onclick="javascript:checkAgainPrint('${item.id}')">重新制证</button>
                    <button type="button" class="approlist_save_item btn btn-primary" onclick="javascript:checkOK('${item.id}','20');">复核完成</button>
                </div>
            </div>
        </div>
    </div>
</c:forEach>


<script type="text/javascript">
    function todo(id,status)
    {
        $("#_ID").val(id);
        $("#_STATUS").val(status);
        $('#myModal2').modal('show');
    }
    function cmdPrint()
    {
        var id = $("#_ID").val();
        var status = $("#_STATUS").val();
        var url ="${ctx}/passport/updateStatus";
        $.post(url,{"id":id,"status":status},function(data)
        {
            if(data.code == 0)
            {
                $('#myModal2').modal('hide');
                $('#myModal3').modal('show');
            }
        },"json");
    }

    function againPrint()
    {
        var id = $("#_ID").val();
        var url ="${ctx}/passport/againPrint";
        $.post(url,{"id":id},function(data)
        {
            if(data.code == 0)
            {
                $('#myModal2').modal('hide');
                $('#myModal3').modal('hide');
                window.location.reload();
            }
        },"json");
    }
    function checkOK(id,status)
    {
        var url ="${ctx}/passport/updateStatus";
        $.post(url,{"id":id,"status":status},function(data)
        {
            if(data.code == 0)
            {
                $('#myModal_'+id).modal('hide');
                window.location.reload();
            }
        },"json");
    }
    function checkAgainPrint(id)
    {
        var url ="${ctx}/passport/checkAgainPrint";
        $.post(url,{"id":id},function(data)
        {
            if(data.code == 0)
            {
                $('#myModal2').modal('hide');
                $('#myModal3').modal('show');
                window.location.reload();
            }
        },"json");
    }
    function detail(div_id)
    {
        $('#'+div_id).modal('show');
    }
    function close3()
    {
        $('#myModal3').modal('hide');
        window.location.reload();
    }
    function search()
    {
        var cardNO = $('#cardNO').val();
        window.location.href="${ctx}/passport/search/10/"+cardNO;
    }
</script>

</body>
</html>
